package com.fiberhome.app.network.http;

import java.util.Map;

import okhttp3.OkHttpClient;

/**
 * Created by Deed on 2018/1/18.
 */

public class HttpFactory {
    private boolean https;
    /**
     *
     * @param https boolean
     */
    public HttpFactory(boolean https) {
        this.https = https;
    }

    /**
     *
     * @param url String
     * @return HttpBuilder
     */
    public HttpBuilder get(String url) {
        HttpBuilder httpBuilder = new HttpBuilder(https);
        httpBuilder.method = HttpBuilder.GET;
        httpBuilder.url = url;
        return httpBuilder;
    }

    /**
     *
     * @param url String
     * @param params Map<String,String>
     * @return HttpBuilder
     */
    public HttpBuilder post(String url, Map<String,String> params) {
        HttpBuilder httpBuilder = new HttpBuilder(https);
        httpBuilder.method = HttpBuilder.POST;
        httpBuilder.url = url;
        httpBuilder.params = params;
        return httpBuilder;
    }
}
